#!/usr/bin/env python3
# -*- coding: utf-8 -*
# Time :2024-06-17 17:06
# @Author: baiping
import xlrd


class ExlOperation:

    def __init__(self,path='../until/AutoCase.xlsx'):
        with xlrd.open_workbook(path) as workbook:
            self.workbook = workbook

    #获取sheet页
    def get_sheet(self,sheet_name):
        self.sheet_page=self.workbook.sheet_by_name(sheet_name)

    #获取行数
    def get_row(self):
        return self.sheet_page.nrows

    #获取列数
    def get_col(self):
        return self.sheet_page.ncols

    #获取单元格内容
    def get_cell(self,row,col):
        try:
            return self.sheet_page.cell_value(row,col)
        except Exception as e:
            print(f'visit cell error：{e}')